package com.bookmanage.dao;

import com.bookmanage.utils.DBUitls;

import java.sql.*;

public class RentAddConn {
    public static void add(String user, String sex, String grade, String book, String start, String end) {
        try {
            Connection conn = DBUitls.getConn();

            String sql = "insert into bookrentifo values(?,?,?,?,?,?)";
            //预处理编译sql
            PreparedStatement pst = (PreparedStatement) conn.prepareStatement(sql);
            //设置数据库的五个参数
            pst.setString(1, user);
            pst.setString(2, sex);
            pst.setString(3, grade);
            pst.setString(4, book);
            pst.setString(5, start);
            pst.setString(6, end);
            pst.executeUpdate();

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
